<%@ page language="Java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="java.util.*" import="com.mingrisoft.jdbc.ProductEntity"%>
<% 
String path = request.getContextPath(); 
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 
%>
<html>
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">    
    <title>查询商品信息</title>        
 </head>
 <body>
<table align="center" width="450" border="1">
	<tr>
		<td align="center" colspan="5">
			<h2>所有商品信息</h2>
		</td>
	</tr>
	<tr align="center">
		<td><b>ID</b></td>
		<td><b>商品名称</b></td>
		<td><b>价格</b></td>
		<td><b>数量</b></td>
		<td><b>单位</b></td>
	</tr>
	<%
		//获取图书信息集合
		List<ProductEntity> list = (List<ProductEntity>)request.getAttribute("list");
		//判断集合是否有效
		if(list == null || list.size()<1){
			out.print("没有数据");
		}else{
			//遍历图书集合中的数据
			for(ProductEntity product : list){
	%>
	<tr align="center">
		<td><%=product.getId() %></td>
		<td><%=product.getProductName() %></td>
		<td><%=product.getProductPrice() %></td>
		<td><%=product.getProductNum() %></td>
		<td><%=product.getProductUnit() %></td>
	</tr>
	
	<%
			}
		}
	%>
	<tr>
		<td align="center" colspan="5">
			<%=request.getAttribute("bar") %>
		</td>
	</tr>
</table>
 </body>
</html>